﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for Util
/// </summary>
public class Util
{
    public static string WrapText(String text, int length)
    {
        string ret = text;

        if (text.Length > length)
        {
            string newString = "";

            string[] splitted = text.Split(' ');

            foreach (string tempString in splitted)
            {
                if (newString.Length + tempString.Length < length)
                {
                    newString += " " + tempString;
                }
            }

            ret = newString;
        }

        return ret;
    }
}